quartz: fix pixelated image surfaces in retina/hidpi mode
authorChristoph Reiter <creiter@src.gnome.org>
Wed, 16 Mar 2016 18:25:30 +0000 (19:25 +0100)
committerChristoph Reiter <creiter@src.gnome.org>
Wed, 23 Mar 2016 15:27:10 +0000 (16:27 +0100)
commit3f077ec36f4a59e803c9f4509996269c862e04af
tree09f0237775ed58cb4bd0c2a24c28db192d5ed64b
parent3a5848820c0f7d67b6054d872e2e7a1ee6e42de6
quartz: fix pixelated image surfaces in retina/hidpi mode

gtk+ currently depends on the scaling factor and the cairo device scale
of both the backend surfaces and image surfaces to be equal.

Until now we didn't apply a cairo device scale at all and depended on the
automatic scaling of CGContexts. This works when drawing with cairo but
fails in case of image surfaces, which get requested at a too small size.

To make the quartz backend behave more like the X11 one, set the cairo device
scale on the surface in gdk_quartz_ref_cairo_surface(). As this conflicts
with the default scaling done by CGContext (we would get double scaling)
undo the CGContext scaling using CGContextScaleCTM().

This patch is based on the following patches by Brion Vibber:
    https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4
    https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4

https://bugzilla.gnome.org/show_bug.cgi?id=763779
gdk/quartz/gdkwindow-quartz.c